cmake_minimum_required(VERSION 3.5.1)
project(planning)


add_subdirectory(integration_tests)

add_subdirectory(common)
add_subdirectory(constraint_checker)
add_subdirectory( traffic_rules )
add_subdirectory(lattice/behavior)
add_subdirectory(lattice/trajectory_generation)
add_subdirectory(math)
add_subdirectory( navi/decider )

add_subdirectory(open_space/coarse_trajectory_generator)
add_subdirectory(open_space/trajectory_smoother)
add_subdirectory(open_space/tools)

add_subdirectory( planner )

add_subdirectory(proto)

add_subdirectory(reference_line)

add_subdirectory( scenarios )

add_subdirectory( tasks )




add_library( planning_lib  
navi_planning.cc
on_lane_planning.cc
planning_base.cc)
target_link_libraries( planning_lib
# gtest
# gtest_main
common_util_module

traffic_rules
traffic_decider
cyber
adapter_gflags
common::message_util
localization_proto
planning_proto
prediction_proto
perception_proto
map_relative_map_proto
common
common::config_gflags
common::math
common::proto
common::message_util
common::vehicle_state_provider
map_hdmap_util
planning_common_module
planning_constraint_checker_module
planning::planning_gflags
planning_trajectory_stitcher
planning::util_lib
planner
planner_dispatcher
smoother
traffic_decider
task_factory
planning_test_base
)




add_library( planning_component_lib planning_component.cc)
target_link_libraries( planning_component_lib 
planning_lib
cyber
adapter_gflags
common::message_util
localization_proto
planning_proto
prediction_proto
perception_proto
map_relative_map_proto
Eigen3::Eigen
common
)


add_library(planning INTERFACE)
target_include_directories(planning INTERFACE
    ${osqp_INCLUDE_DIRS}
    ${IPOPT_INCLUDE_DIRS}
    ${ADOLC_INCLUDE_DIRS}
    ${CUDA_INCLUDE_DIRS})
target_link_libraries(planning INTERFACE

planning_component_lib
planning_lib
planning_common_module
planning_constraint_checker_module
planning_proto
planning_common_module
planning_reference_line_module   
planning_lattice_behavior_module
planning_lattice_trajectory_generation_module
planning_open_space_trajectory_smoother_module
planning_open_space_tools_module

)



add_executable(planning_component_demo  planning_component_demo.cc)
target_link_libraries(planning_component_demo 
 planning
 cyber::log
common_adapters_module
common_config_gflags
common::util
common::vehicle_state_provider
gtest
gtest_main
 )


install(TARGETS 
planning
planning_component_lib
planning_lib
    EXPORT  apollo-export
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    RUNTIME DESTINATION bin
    INCLUDES DESTINATION .
)
